package com.qidian.buy.search.controller;

import com.qidian.buy.search.service.SearchService;
import com.qidian.buy.util.pojo.BuyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 戴着假发的程序员
 * @Company 起点编程
 * @date 2023/5/23 14:05
 */
@RestController
@CrossOrigin
@RequestMapping("/buy/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    @GetMapping("/import")
    public BuyResult importIndex(){
        return searchService.importIndex();
    }

    @GetMapping("/list")
    public BuyResult list(@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "60")int limit,String keyword){
        return searchService.search(keyword,page,limit);
    };
}
